<?php
/**
* form file for the user module
*
* this file contains all of the forms for the user module, has forms for logging in
* as well as registration
*
*@author		wil hamilton <wil.hamilton@gmail.com>
*@license		bsd
*@version		0.5
*@package		user module
* @todo 		finish commenting
 */

class userForms extends form {

	public static function register($errors)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('register') . '</legend>
					<ul class="form">
						<li>
							<label for="email">' . language_phrase::get('email') . ':</label>
							<input type="text" id="email" name="email" value="' . self::postValue('email') .'" />
						</li>
						<li>
							<label for="confirmEmail">' . language_phrase::get('confirm-email') . ':</label> 
							<input type="text" id="confirmemail" name="confirmEmail" value="" />
						</li>
						<li>
							<label for="password">' . language_phrase::get('password') . ':</label>
							<input type="password" id="password" name="password" value="" />
						</li>
						<li>
							<label for="confirmPassword">' . language_phrase::get('confirm-password') . ':</label>
							<input type="password" id="confirmPassword" name="confirmPassword" value="" />
						</li>
						<li>
							<label for="username">' . language_phrase::get('username') . ':</label>
							<input type="text" id="username" name="username" value="' . self::postValue('username') .'" />
						</li>
						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('register') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
	
	public static function login($errors)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('login') . '</legend>
					<ul class="form">
						<li>
							<label for="email">' . language_phrase::get('email') . ':</label>
							<input type="text" id="email" name="email" value="' . self::postValue('email') .'" />
						</li>
						<li>
							<label for="password">' . language_phrase::get('password') . ':</label>
							<input type="password" id="password" name="password" value="" />
						</li>
						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('login') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
	
	public static function resetPassword($errors)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('reset-password') . '</legend>
					<ul class="form">
						<li>
							<label for="email">' . language_phrase::get('email') . ':</label>
							<input type="text" id="email" name="email" value="' . self::postValue('email') .'" />
						</li>
						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('reset-password') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
	
	public static function editUser($errors, $user)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('edit-user') . '</legend>
					<ul class="form">
						<li>
							<label for="email">' . language_phrase::get('email') . ':</label>
							<input type="text" id="email" name="email" value="' . $user->email .'" />
						</li>
						<li>
							<label for="username">' . language_phrase::get('username') . ':</label>
							<input type="text" id="username" name="username" value="' . $user->username .'" />
						</li>
						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('edit-user') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
	
	public static function adminEditUser($errors, $user)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('edit-user') . '</legend>
					<ul class="form">
						<li>
							<label for="email">' . language_phrase::get('email') . ':</label>
							<input type="text" id="email" name="email" value="' . $user->email .'" />
						</li>
						<li>
							<label for="password">' . language_phrase::get('password') . ':</label>
							<input type="password" id="password" name="password" value="" />
						</li>
						<li>
							<label for="username">' . language_phrase::get('username') . ':</label>
							<input type="text" id="username" name="username" value="' . $user->name .'" />
						</li>
						<li>
							<label for="permissions">' . language_phrase::get('permissions') . ':</label>
							<input type="text" id="permissions" name="permissions" value="' . $user->permissions .'" />
						</li>
						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('edit-user') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
	
	public static function changePassword($errors)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('change-password') . '</legend>
					<ul class="form">
						<li>
							<label for="oldpassword">' . language_phrase::get('old-password') . ':</label>
							<input type="password" id="oldpassword" name="oldpassword" value="" />
						</li>
						<li>
							<label for="password">' . language_phrase::get('new-password') . ':</label>
							<input type="password" id="password" name="password" value="" />
						</li>
						<li>
							<label for="confirmPassword">' . language_phrase::get('confirm-password') . ':</label>
							<input type="password" id="confirmPassword" name="confirmPassword" value="" />
						</li>
						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('change-password') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
	
	public static function addGroup($errors)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('add-group') . '</legend>
					<ul class="form">
						<li>
							<label for="name">' . language_phrase::get('name') . ':</label>
							<input type="text" id="name" name="name" value="' . self::postValue('name') . '" />
						</li>
						<li>
							<label for="permissions">' . language_phrase::get('permissions') . ':</label>
							<input type="text" id="permissions" name="permissions" value="' . self::postValue('permissions') . '" />
						</li>

						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('add-group') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
	
	public static function editGroup($errors, $group)
	{
		$show = self::dispErrors($errors);
		$show .= '
			<form action="" method="post">
				<fieldset>
					<legend>' . language_phrase::get('edit-group') . '</legend>
					<ul class="form">
						<li>
							<label for="name">' . language_phrase::get('name') . ':</label>
							<input type="text" id="name" name="name" value="' . $group->name . '" />
						</li>
						<li>
							<label for="permissions">' . language_phrase::get('permissions') . ':</label>
							<input type="text" id="permissions" name="permissions" value="' . $group->permissions . '" />
						</li>

						<li>
							<input type="submit" name="submit" value="' . language_phrase::get('edit-group') . '" />
						</li>
					</ul>
				</fieldset>
			</form>';
			
		return $show;
	}
}
?>